# -*- coding: utf-8 -*-
import mysql.connector

'''
    这里的占位符是%s ,不是?号
    带参数的执行 python自动转为preparedstatement了，不用担心注入问题
'''


config = {
    'user': 'root',
    'password': 'passwd32',
    'host': '172.16.2.187',
    'port': '33096',
    'database': 'jjsesf-test',
    # 'raise_on_warnings': True,
    'use_unicode': True
}

# conn = mysql.connector.connect(user=u"root", password=u"passwd32", port=33096 ,host=u"172.16.2.187", database=u"jjsesf-test", use_unicode=True)
conn = mysql.connector.connect(**config)
cursor = conn.cursor()
cursor.execute("update XQ_APPROVAL_LOG set type = 3 where id = 143")
conn.commit()
print cursor.rowcount
cursor.close()

querycur = conn.cursor()
querycur.execute("select * from XQ_APPROVAL_LOG where id < %s  ", (200,))

values = querycur.fetchall()

print values

cursor.close()
conn.close()




